package org.example.springcloudalibaba.controller;



import org.example.springcloudalibaba.dao.StorageDao;
import org.example.springcloudalibaba.domain.CommonResult;
import org.example.springcloudalibaba.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class StorageController {

    @Autowired
    private StorageService storageService;
    @Resource
    private StorageDao storageDao;
    /**
     * 扣减库存
     */
    @RequestMapping("/storage/decrease")
    public CommonResult decrease(Long productId, Integer count) {
        storageService.decrease(productId, count);
        return new CommonResult(200,"扣减库存成功！");
    }
}
